<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>招聘会详情</title>
	<link rel="stylesheet" href="./styles/css/common.css">
	<style>
		.station_con {
			padding: 20px 0 10px;
		}

		/* form表单内 单行样式 */
		.form_item {
			color: #5a5a5a;
			margin-bottom: 25px;
			text-align: center;
		}

		.form_item .item_con {
			display: inline-block;
		}

		.form_item .item_label {
			float: left;
			width: 100px;
			text-align: right;
			height: 30px;
			line-height: 30px;
			margin-right: 10px;
		}

		.form_item .item_content {
			float: left;
			width: 300px;
			position: relative;
		}

		.form_item .item_name {
			display: block;
			line-height: 24px;
			margin: 4px 0;
		}

		.form_item .item_input,
		.form_item .item_select,
		.item_textarea {
			width: 300px;
			border: 1px solid #ccc;
			height: 30px;
			line-height: 30px;
			padding-left: 10px;
			box-sizing: border-box;
			border-radius: 4px;
			font-size: 14px;
			color: #333333;
		}

		.form_item .item_textarea {
			height: 100px;
			resize: none;
		}

		.form_item .item_select {
			padding: 3px 0;
		}

		.form_item .item_select[disabled] {
			background: #efeded;
		}

		.item_content .hj_con {
			position: absolute;
			top: 30px;
			left: 0;
			z-index: 3;
			width: 100%;
			max-height: 300px;
			overflow-x: hidden;
			overflow-y: auto;
			background: #ffffff;
			box-shadow: 0 0px 3px #808080;
			padding: 10px;
			box-sizing: border-box;
			display: none;
		}

		.item_content .hj_con span {
			display: block;
			cursor: pointer;
			font-size: 14px;
			border-bottom: 1px dashed #ccc;
			padding: 4px 0;
		}

		.item_content .hj_con span:hover {
			background-color: #66bdff;
			color: #fff;
		}

		.item_content .hj_con .no_hj {
			text-align: center;
			color: #858585;
			font-size: 14px;
		}
		.item_content .error_info {
			top: 36px;
		}
		.areaText .error_info {
			top: 108px;
		}

		.btn_con {
			text-align: center;
		}

		.base_btn {
			display: inline-block;
			width: 115px;
			height: 36px;
			line-height: 36px;
			border-radius: 4px;
			background-color: #246fde;
			color: #fff;
			margin: 40px auto 30px;
			text-align: center;
			box-sizing: border-box;
			cursor: pointer;
		}
	</style>
</head>

<body>
	<div class="zph_detail">
		<!-- 公共顶部 -->
		<!-- <include src="./include/top.html"></include> -->
		<script src="http://rsj.beijing.gov.cn/header.js"></script>

		<!-- 头部 -->
		<div class="job_header">
			<div class="job_header_con clearfix">
				<a href="./index.html" class="left">
					<img src="./styles/images/logo.png" alt="">
				</a>
				<span class="left job_fontimg"></span>
			</div>
		</div>
		<!-- 职位详情 nav -->
		<div class="zpxq_nav" id="J_area">
			<script type="text/html" id="J_item">
			<%if(+data.executeResult == 1){%>
				<% var _data = data.zphxx%>
			<div class="zpxq_nav_con clearfix">
				<div class="nav_left left">
					<p class="nav_time">开始时间： <%=_data.zphkssj?_data.zphkssj.substring(0,10):"--"%>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						结束时间：<%=_data.zphjssj?_data.zphjssj.substring(0,10):"--"%></p>
					<p class="nav_name"><%=_data.zphmc%></p>
					<div class="nav_wz clearfix">
						<!-- <p class="nav_dz left">地址：<%=_data.zphdd%></p> -->
						<p class="nav_dw left">主办单位：<%=_data.zbjgmc%></p>
					</div>
				</div>
				<div class="nav_right right">
					<p class="nav_num"><%=_data.cgdws%></p>
					<p class="nav_num_title">参会单位数量（家）</p>
				</div>
			</div>
			<%}%>
			</script>
		</div>
		<!-- 已报名招聘岗位信息 -->
		<div class="resultpage_option clearfix">
			<div class="z_b_bottom clearfix">
				<div class="option_left left">
					已报名招聘岗位信息
				</div>
			</div>
			<div class="resultpage_table" id="resultpage_table">
				<script type="text/html" id="resultpage_area">
				</script>
			</div>
		</div>
		<!-- 查询样式 -->
		<div class="resultpage_option clearfix">
			<div class="z_b_bottom clearfix">
				<div class="option_left left">
					招聘岗位信息
				</div>
			</div>
			<div class="station_con">
				<form name="station" msgtype="2" validate="blur">
					<div class="form_item ">
						<div class="item_con clearfix">
							<span class="item_label">岗位名称:</span>
							<div class="item_content">
								<input type="text" class="item_input J_gwmc" valiflag="32,full,岗位名称" paramete="gwmc" v_require>
								<div class="hj_con">
								</div>
							</div>
						</div>
					</div>
					<div class="form_item">
						<div class="item_con clearfix">
							<span class="item_label">招聘人数:</span>
							<div class="item_content">
								<input type="text" class="item_input J_zprs" valiflag="3,number,招聘人数" paramete="zprs" v_require>
							</div>
						</div>
					</div>
					<div class="form_item">
						<div class="item_con clearfix">
							<span class="item_label">用工形式:</span>
							<div class="item_content">
								<input type="text" class="item_input J_ygxs" valiflag="32,full,最低薪酬" paramete="ygxs" v_require>
							</div>
						</div>
					</div>
					<div class="form_item">
						<div class="item_con clearfix">
							<span class="item_label">薪酬待遇:</span>
							<div class="item_content">
								<input type="text" class="item_input J_zgxc" valiflag="32,full,最高薪酬" paramete="zgxc" v_require>
							</div>
						</div>
					</div>
					<div class="form_item">
						<div class="item_con clearfix">
							<span class="item_label">福利待遇:</span>
							<div class="item_content areaText">
								<textarea class="item_textarea J_fldy" valiflag="120,full,福利待遇" paramete="fldy" v_require></textarea>
							</div>
						</div>
					</div>
					<div class="form_item">
						<div class="item_con clearfix">
							<span class="item_label">岗位要求:</span>
							<div class="item_content areaText">
								<textarea class="item_textarea J_gwyq" valiflag="120,full,岗位要求" paramete="gwyq" v_require></textarea>
							</div>
						</div>
					</div>
					<div class="btn_con">
						<div class="base_btn J_save">报名</div>
					</div>
				</form>
			</div>

		</div>
		<script src="http://rsj.beijing.gov.cn/footer.js"></script>
</body>
<script src="./common/vendor.js"></script>
<script src="./common/common.js"></script>
<script src="./common/generaltools.js"></script>
<script src="./date/WdatePicker.js"></script>
<script src="./common/validator.js"></script>
<script>
	$(function () {

		var zpq_Arr = [];
		var gwxx = {}
		// 获取基本信息
		getBase();
		var zphid = $.paramObj().zphid;
		// 招聘会信息
		getZph(zphid);
		//获取已报名招聘岗位信息
		doneReport(zphid);

		$(document).on('focus', '.search_input', function () {
			$(this).prev('.Showpass').hide();
		})
		$(document).on('blur', '.search_input', function () {
			if (!$(this).val()) {
				$(this).prev('.Showpass').show();
			}
		})
		// 获取招聘会信息
		function getZph() {
			$.asyncRender({
				url: '/zxhd_x/zphxxCx',
				type: 'get',
				data: {
					zphid: zphid
				},
				wrap: '#J_area',
				tem: '#J_item',
				pos: 'returnData',
			}).done(function (res) {
				var _res = res.returnData;
				if (+_res.executeResult === 1) {
				} else {
					$.layerMsg(_res.message, '我知道了');
				}
			})
		}

		// 获取已报名招聘岗位信息
		function doneReport(zphid) {
			var _data = {
				zphid: zphid
			}
			$('#resultpage_table').pageTool({
				url: '/zxhd_x/ybmgwCx',
				type: 'get',
				data: _data,
				locator: 'returnData',
				errMes: '当期无已报名招聘岗位信息',
				callback: function (result) {
					// Loading.off();
					var msg = result.returnData;
					if (msg.executeResult == '1') {
						index++;
					} else {
						$.layerMsg(msg.message, '我知道了', function () {
							// window.location.href = './index.html';
							return false;
						});
					}
				}
			});
		}

		// 模糊查询
		$(document).on('input propertychange', '.J_gwmc', function () {
			var _inputdata = $(this).val();
			var han = /^[\u4e00-\u9fa5]+$/;
			$(this).attr('attrid', '');
			if (!han.test(_inputdata)) {
				if (_inputdata) {
					$('.hj_con').show();
					$('.hj_con').html('<p class="no_hj">暂无相关岗位名称！</p>')
				} else {
					$('.hj_con').hide();
				}
				return false;
			}
			$.fetch({
				url: '/zxhd_x/tsgwCx',
				type: 'get',
				data: {
					gwmc: _inputdata
				}
			}).done(function (result) {
				var _inputres = result.returnData;
				if (+_inputres.executeResult == 1) {
					var _Data = _inputres.tsgwxx;
					render_hj(_Data);
				} else {
					$.layerMsg(_inputres.message, '我知道了');
				}
			})
		});

		$(document).on('focus', '.J_gwmc', function (event) {
			var e = arguments.callee.caller.arguments[0] || event;
			if (e && e.stopPropagation) {
				// this code is for Mozilla and Opera
				e.stopPropagation();
			} else if (window.event) {
				// this code is for IE
				window.event.cancelBubble = true;
			}
			var _data = $(this).val();
			$.fetch({
				url: '/zxhd_x/tsgwCx',
				type: 'get',
				data: {
					gwmc: _data
				}

			}).done(function (res) {
				var _res = res.returnData;
				if (+_res.executeResult == 1) {
					var _data = _res.tsgwxx;
					render_hj(_data);
				} else {
					$.layerMsg(_res.message, '我知道了');
				}
			})
		})

		$(document).on('click', function (event) {
			var e = window.event || arguments.callee.caller.arguments[0];
			var _target = e.target || e.srcElement;
			if ($('.hj_con').css('display') == 'block' && !$('.J_gwmc').is(_target)) {
				if ($('.J_gwmc').attr('attrid') != '') {
					$('.hj_con').hide();
				} else {
					$('.hj_con').hide();
					$('.J_gwmc').val('');
					$('.J_gwmc').attr('attrid', '');
				}
			}
		})

		// 渲染户籍
		function render_hj(data) {
			$('.hj_con').show();
			if (data.length == 0) {
				$('.hj_con').html('<p class="no_hj">暂无相关户籍所在地！</p>')
			} else {
				var html = '';
				$.each(data, function (k, v) {
					html += ' <span title="' + v.gwmc + '" attrid="' + v.gwbh + '" gwbh="'+v.gwbh+'" ssgzbh="' + v.ssgzbh + '">' + v.gwmc + '</span>'
				})
				$('.hj_con').html(html)
			}
		}

		$(document).on('click', '.hj_con span', function () {
			var _error = $('.J_gwmc').parent().find('.error_info');
			var _attrid = $(this).attr('attrid');
			var _val = $(this).text();
			$('.J_gwmc').attr('attrid', _attrid);
			$('.J_gwmc').val(_val);
			_error.hide();
			gwxx['gwbh']=$(this).attr('gwbh');
			gwxx['ssgzbh']=$(this).attr('ssgzbh');
			gwxx['gwmc']=_val;
			$('.hj_con').hide();
		})

		// 点击报名
		$(document).on('click', '.J_save', function () {
			var _data = $('form[name="station"]').getFormData();
      if (validate('station')) {
				_data.gwbh = gwxx.gwbh;
				_data.ssgzbh = gwxx.ssgzbh;
				console.log(_data)
			}
		})
	});
</script>

</html>
